/*
 * Socket.h
 *
 *  Created on: 15/05/2011
 *      Author: dela
 */

#ifndef SOCKET_H_
#define SOCKET_H_

#define socklen_t int

class Socket {
private:
	unsigned int sockfd;
public:
	Socket() { sockfd = 0; };
	Socket(int port);
	Socket(unsigned int fd) : sockfd(fd) {};
	~Socket();
	unsigned int getfd() {return sockfd;};
	void shutdownSocket();

	/**
	 * Acepta nuevas conexiones y devuelve el socketfd
	 */
	unsigned int acceptConnection();

	/**
	 * Conecta el socket
	 */
	int connectSocket( char* ip, int port );
};

#endif /* SOCKET_H_ */
